package com.yxh.www.author.api;

import com.yxh.www.common.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * <p>
 * 授权中心 - 系统用户对象关系控制API集
 * </p>
 *
 * @author yangxiaohui
 * @since 2020/5/12
 */
@FeignClient(value = "author-server", contextId = "authorSmUserObjectRelation")
public interface AuthorSmUserObjectRelationApi {
    /**
     * 新增系统用户对象关系
     *
     * @param userId     用户ID    必填
     * @param objectIds   对象ID    必填
     * @param objectType 对象类型（0：角色；1：组织） 默认值0
     * @return 统一响应 {@link Result}
     */
    @PostMapping("/smUserObjectRelation/addSmUserObjectRelation")
    Result<Object> addSmUserObjectRelation(@RequestParam String userId,
                                           @RequestParam String[] objectIds,
                                           @RequestParam(defaultValue = "0") String objectType);

    /**
     * 根据用户对象关系ID删除关系
     * @param ids   关系ID集合
     * @return  统一响应 {@link Result}
     */
    @DeleteMapping("/smUserObjectRelation/removeSmUserObjectRelation")
    Result<Object> removeSmUserObjectRelation(@RequestParam String[] ids);

    /**
     * 根据用户ID删除 用户对象关系
     *
     * @param userId 用户ID    必填
     * @return 统一响应 {@link Result}
     */
    @DeleteMapping("/smUserObjectRelation/removeSmUserObjectRelationByUserId")
    Result<Object> removeSmUserObjectRelationByUserId(@RequestParam String userId);

    /**
     * 根据对象ID删除 用户对象关系
     *
     * @param objectId 对象ID  必填
     * @return 统一响应 {@link Result}
     */
    @DeleteMapping("/smUserObjectRelation/removeSmUserObjectRelationByObjectId")
    Result<Object> removeSmUserObjectRelationByObjectId(@RequestParam String objectId);

    /**
     * 根据用户ID和 对象ID 解除用户对象关系
     *
     * @param userId   用户ID    必填
     * @param objectId 对象ID    必填
     * @return 统一响应 {@link Result}
     */
    @DeleteMapping("/smUserObjectRelation/removeSmUserObjectRelationByUserIdAndObjectId")
    Result<Object> removeSmUserObjectRelationByUserIdAndObjectId(@RequestParam String userId,
                                                                 @RequestParam String objectId);

}
